# $(ROOT)/mpp/Mafile

ifeq ($(PARAM_FILE), )
    PARAM_FILE:=../../mpp/Makefile.param
    include $(PARAM_FILE)
endif

EXTDRV_KO=$(REL_KO)/extdrv

sub_dir := $(shell find . -maxdepth 1 -type d)
sub_dir := $(basename $(patsubst ./%,%,$(sub_dir)))
clean_dir := $(foreach dir, $(sub_dir), $(patsubst %, %_clean, $(dir)))

.PHONY:clean all $(sub_dir) $(clean_dir)
all: $(sub_dir)
	@echo -e "\e[0;32;1m--Compiling 'lite extdrv'... Configs as follow:\e[0;36;1m"
	@echo ---- CROSS=$(CROSS)
	@echo ---- HIARCH=$(HIARCH), HICHIP=$(HICHIP), CVER=$(CVER)
	@echo ---- SDK_PATH=$(SDK_PATH) , PARAM_FILE=$(PARAM_FILE)
	@echo ---- KERNEL_ROOT=$(KERNEL_ROOT)
	@echo -e "\e[0m"

$(sub_dir):
	@cd $@ && make

clean: $(clean_dir)
	@echo -e "Clean ok."

$(clean_dir):
	@cd $(patsubst %_clean, %, $@) && make clean
